<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test2::API - Primary interface for writing Test2 based testing tools. - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Test2::API">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Test2::API">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Test2::API">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Test2::API">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Test2::API">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Test2::API">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Test2::API">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Test2::API">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Test2::API">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Test2::API">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Test2::API">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Test2::API">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Test2::API">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Test2::API">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Test2::API">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Test2::API">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Test2::API">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Test2::API">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Test2::API">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Test2::API">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Test2::API">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Test2::API">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Test2::API">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Test2::API">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Test2::API">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Test2::API">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Test2::API">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Test2::API">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Test2::API">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Test2::API">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Test2::API">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Test2::API">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Test2::API">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Test2::API">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Test2::API">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Test2::API">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Test2::API">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Test2::API">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Test2::API">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Test2::API">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Test2::API">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Test2::API">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Test2::API">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Test2::API">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Test2::API">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Test2::API">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Test2::API">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Test2::API">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Test2::API">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Test2::API">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Test2::API">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Test2::API">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Test2::API">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Test2::API">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Test2::API">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Test2::API">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Test2::API">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Test2::API">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Test2::API">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Test2::API">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Test2::API">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Test2::API">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Test2::API">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Test2::API">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Test2::API">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Test2::API">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Test2::API">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Test2::API">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Test2::API">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Test2::API">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Test2::API">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Test2::API">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Test2::API">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Test2::API">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Test2::API">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Test2::API">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Test2::API">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Test2::API">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Test2::API">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Test2::API">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Test2::API">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Test2::API">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Test2::API">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Test2::API">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Test2::API">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Test2::API">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Test2::API">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Test2::API">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Test2::API">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Test2::API">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Test2::API">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Test2::API">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Test2::API">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Test2::API">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Test2::API">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Test2::API">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Test2::API">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Test2::API">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Test2::API">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Test2::API">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Test2::API">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Test2::API">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Test2::API">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Test2::API">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Test2::API">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Test2::API">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Test2::API">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Test2::API">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Test2::API">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Test2::API">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Test2::API">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Test2::API">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Test2::API">5.35.1</a>
          <a class="dropdown-item active" href="./Test2::API.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::API.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Test2::API.html">Test2::API</a>
          <div id="more">
            (<a href="./Test2::API.txt">source</a>,
            <a href="https://metacpan.org/pod/Test2::API">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.302183</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#***INTERNALS-NOTE***">***INTERNALS NOTE***</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#SYNOPSIS">SYNOPSIS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#WRITING-A-TOOL">WRITING A TOOL</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#TESTING-YOUR-TOOLS">TESTING YOUR TOOLS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#OTHER-API-FUNCTIONS">OTHER API FUNCTIONS</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#MAIN-API-EXPORTS">MAIN API EXPORTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#context(...)">context(...)</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#OPTIONAL-PARAMETERS">OPTIONAL PARAMETERS</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#release($;$)">release($;$)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#context_do(&amp;;@)">context_do(&amp;;@)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#no_context(&amp;;$)">no_context(&amp;;$)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#intercept(&amp;)">intercept(&amp;)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#run_subtest(...)">run_subtest(...)</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#ARGUMENTS:">ARGUMENTS:</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#BUFFERED-VS-UNBUFFERED-(OR-STREAMED)">BUFFERED VS UNBUFFERED (OR STREAMED)</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#OTHER-API-EXPORTS">OTHER API EXPORTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#STATUS-AND-INITIALIZATION-STATE">STATUS AND INITIALIZATION STATE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#BEHAVIOR-HOOKS">BEHAVIOR HOOKS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#IPC-AND-CONCURRENCY">IPC AND CONCURRENCY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#MANAGING-FORMATTERS">MANAGING FORMATTERS</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#OTHER-EXAMPLES">OTHER EXAMPLES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#MAGIC">MAGIC</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#SOURCE">SOURCE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#MAINTAINERS">MAINTAINERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::API.html#COPYRIGHT">COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Test2::API.html#NAME">#</a>NAME</h1>

<p>Test2::API - Primary interface for writing Test2 based testing tools.</p>

<h1 id="***INTERNALS-NOTE***"><a class="permalink" href="./Test2::API.html#***INTERNALS-NOTE***">#</a><a id="INTERNALS-NOTE"></a>***INTERNALS NOTE***</h1>

<p><b>The internals of this package are subject to change at any time!</b> The public methods provided will not change in backwards-incompatible ways (once there is a stable release), but the underlying implementation details might. <b>Do not break encapsulation here!</b></p>

<p>Currently the implementation is to create a single instance of the <a href="./Test2::API::Instance.html">Test2::API::Instance</a> Object. All class methods defer to the single instance. There is no public access to the singleton, and that is intentional. The class methods provided by this package provide the only functionality publicly exposed.</p>

<p>This is done primarily to avoid the problems Test::Builder had by exposing its singleton. We do not want anyone to replace this singleton, rebless it, or directly muck with its internals. If you need to do something and cannot because of the restrictions placed here, then please report it as an issue. If possible, we will create a way for you to implement your functionality without exposing things that should not be exposed.</p>

<h1 id="DESCRIPTION"><a class="permalink" href="./Test2::API.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This package exports all the functions necessary to write and/or verify testing tools. Using these building blocks you can begin writing test tools very quickly. You are also provided with tools that help you to test the tools you write.</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Test2::API.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<h2 id="WRITING-A-TOOL"><a class="permalink" href="./Test2::API.html#WRITING-A-TOOL">#</a><a id="WRITING"></a>WRITING A TOOL</h2>

<p>The <code>context()</code> method is your primary interface into the Test2 framework.</p>

<pre><code>package My::Ok;
use Test2::API qw/context/;

our @EXPORT = qw/my_ok/;
use base &#39;Exporter&#39;;

# Just like ok() from Test::More
sub my_ok($;$) {
    my ($bool, $name) = @_;
    my $ctx = context(); # Get a context
    $ctx-&gt;ok($bool, $name);
    $ctx-&gt;release; # Release the context
    return $bool;
}</code></pre>

<p>See <a href="./Test2::API::Context.html">Test2::API::Context</a> for a list of methods available on the context object.</p>

<h2 id="TESTING-YOUR-TOOLS"><a class="permalink" href="./Test2::API.html#TESTING-YOUR-TOOLS">#</a><a id="TESTING"></a>TESTING YOUR TOOLS</h2>

<p>The <code>intercept { ... }</code> tool lets you temporarily intercept all events generated by the test system:</p>

<pre><code>use Test2::API qw/intercept/;

use My::Ok qw/my_ok/;

my $events = intercept {
    # These events are not displayed
    my_ok(1, &quot;pass&quot;);
    my_ok(0, &quot;fail&quot;);
};</code></pre>

<p>As of version 1.302178 this now returns an arrayref that is also an instance of <a href="./Test2::API::InterceptResult.html">Test2::API::InterceptResult</a>. See the <a href="./Test2::API::InterceptResult.html">Test2::API::InterceptResult</a> documentation for details on how to best use it.</p>

<h2 id="OTHER-API-FUNCTIONS"><a class="permalink" href="./Test2::API.html#OTHER-API-FUNCTIONS">#</a><a id="OTHER"></a>OTHER API FUNCTIONS</h2>

<pre><code>use Test2::API qw{
    test2_init_done
    test2_stack
    test2_set_is_end
    test2_get_is_end
    test2_ipc
    test2_formatter_set
    test2_formatter
    test2_is_testing_done
};

my $init  = test2_init_done();
my $stack = test2_stack();
my $ipc   = test2_ipc();

test2_formatter_set($FORMATTER)
my $formatter = test2_formatter();

... And others ...</code></pre>

<h1 id="MAIN-API-EXPORTS"><a class="permalink" href="./Test2::API.html#MAIN-API-EXPORTS">#</a><a id="MAIN"></a>MAIN API EXPORTS</h1>

<p>All exports are optional. You must specify subs to import.</p>

<pre><code>use Test2::API qw/context intercept run_subtest/;</code></pre>

<p>This is the list of exports that are most commonly needed. If you are simply writing a tool, then this is probably all you need. If you need something and you cannot find it here, then you can also look at <a href="./Test2::API.html#OTHER-API-EXPORTS">&quot;OTHER API EXPORTS&quot;</a>.</p>

<p>These exports lack the &#39;test2_&#39; prefix because of how important/common they are. Exports in the <a href="./Test2::API.html#OTHER-API-EXPORTS">&quot;OTHER API EXPORTS&quot;</a> section have the &#39;test2_&#39; prefix to ensure they stand out.</p>

<h2 id="context(...)"><a class="permalink" href="./Test2::API.html#context(...)">#</a><a id="context"></a>context(...)</h2>

<p>Usage:</p>

<dl>

<dt id="$ctx-=-context()"><a class="permalink" href="./Test2::API.html#$ctx-=-context()">#</a><a id="ctx-context"></a>$ctx = context()</dt>
<dd>

</dd>
<dt id="$ctx-=-context(%params)"><a class="permalink" href="./Test2::API.html#$ctx-=-context(%25params)">#</a><a id="ctx-context-params"></a>$ctx = context(%params)</dt>
<dd>

</dd>
</dl>

<p>The <code>context()</code> function will always return the current context. If there is already a context active, it will be returned. If there is not an active context, one will be generated. When a context is generated it will default to using the file and line number where the currently running sub was called from.</p>

<p>Please see <a href="./Test2::API::Context.html#CRITICAL-DETAILS">&quot;CRITICAL DETAILS&quot; in Test2::API::Context</a> for important rules about what you can and cannot do with a context once it is obtained.</p>

<p><b>Note</b> This function will throw an exception if you ignore the context object it returns.</p>

<p><b>Note</b> On perls 5.14+ a depth check is used to insure there are no context leaks. This cannot be safely done on older perls due to <a href="https://rt.perl.org/Public/Bug/Display.html?id=127774">https://rt.perl.org/Public/Bug/Display.html?id=127774</a> You can forcefully enable it either by setting <code>$ENV{T2_CHECK_DEPTH} = 1</code> or <code>$Test2::API::DO_DEPTH_CHECK = 1</code> <b>BEFORE</b> loading <a href="./Test2::API.html">Test2::API</a>.</p>

<h3 id="OPTIONAL-PARAMETERS"><a class="permalink" href="./Test2::API.html#OPTIONAL-PARAMETERS">#</a><a id="OPTIONAL"></a>OPTIONAL PARAMETERS</h3>

<p>All parameters to <code>context</code> are optional.</p>

<dl>

<dt id="level-=&gt;-$int"><a class="permalink" href="./Test2::API.html#level-=%3E-$int">#</a><a id="level"></a><a id="level-int"></a>level =&gt; $int</dt>
<dd>

<p>If you must obtain a context in a sub deeper than your entry point you can use this to tell it how many EXTRA stack frames to look back. If this option is not provided the default of <code>0</code> is used.</p>

<pre><code>sub third_party_tool {
    my $sub = shift;
    ... # Does not obtain a context
    $sub-&gt;();
    ...
}

third_party_tool(sub {
    my $ctx = context(level =&gt; 1);
    ...
    $ctx-&gt;release;
});</code></pre>

</dd>
<dt id="wrapped-=&gt;-$int"><a class="permalink" href="./Test2::API.html#wrapped-=%3E-$int">#</a><a id="wrapped"></a><a id="wrapped-int"></a>wrapped =&gt; $int</dt>
<dd>

<p>Use this if you need to write your own tool that wraps a call to <code>context()</code> with the intent that it should return a context object.</p>

<pre><code>sub my_context {
    my %params = ( wrapped =&gt; 0, @_ );
    $params{wrapped}++;
    my $ctx = context(%params);
    ...
    return $ctx;
}

sub my_tool {
    my $ctx = my_context();
    ...
    $ctx-&gt;release;
}</code></pre>

<p>If you do not do this, then tools you call that also check for a context will notice that the context they grabbed was created at the same stack depth, which will trigger protective measures that warn you and destroy the existing context.</p>

</dd>
<dt id="stack-=&gt;-$stack"><a class="permalink" href="./Test2::API.html#stack-=%3E-$stack">#</a><a id="stack"></a><a id="stack-stack"></a>stack =&gt; $stack</dt>
<dd>

<p>Normally <code>context()</code> looks at the global hub stack. If you are maintaining your own <a href="./Test2::API::Stack.html">Test2::API::Stack</a> instance you may pass it in to be used instead of the global one.</p>

</dd>
<dt id="hub-=&gt;-$hub"><a class="permalink" href="./Test2::API.html#hub-=%3E-$hub">#</a><a id="hub"></a><a id="hub-hub"></a>hub =&gt; $hub</dt>
<dd>

<p>Use this parameter if you want to obtain the context for a specific hub instead of whatever one happens to be at the top of the stack.</p>

</dd>
<dt id="on_init-=&gt;-sub-{-...-}"><a class="permalink" href="./Test2::API.html#on_init-=%3E-sub-%7B-...-%7D">#</a><a id="on_init"></a><a id="on_init-sub"></a>on_init =&gt; sub { ... }</dt>
<dd>

<p>This lets you provide a callback sub that will be called <b>ONLY</b> if your call to <code>context()</code> generated a new context. The callback <b>WILL NOT</b> be called if <code>context()</code> is returning an existing context. The only argument passed into the callback will be the context object itself.</p>

<pre><code>sub foo {
    my $ctx = context(on_init =&gt; sub { &#39;will run&#39; });

    my $inner = sub {
        # This callback is not run since we are getting the existing
        # context from our parent sub.
        my $ctx = context(on_init =&gt; sub { &#39;will NOT run&#39; });
        $ctx-&gt;release;
    }
    $inner-&gt;();

    $ctx-&gt;release;
}</code></pre>

</dd>
<dt id="on_release-=&gt;-sub-{-...-}"><a class="permalink" href="./Test2::API.html#on_release-=%3E-sub-%7B-...-%7D">#</a><a id="on_release"></a><a id="on_release-sub"></a>on_release =&gt; sub { ... }</dt>
<dd>

<p>This lets you provide a callback sub that will be called when the context instance is released. This callback will be added to the returned context even if an existing context is returned. If multiple calls to context add callbacks, then all will be called in reverse order when the context is finally released.</p>

<pre><code>sub foo {
    my $ctx = context(on_release =&gt; sub { &#39;will run second&#39; });

    my $inner = sub {
        my $ctx = context(on_release =&gt; sub { &#39;will run first&#39; });

        # Neither callback runs on this release
        $ctx-&gt;release;
    }
    $inner-&gt;();

    # Both callbacks run here.
    $ctx-&gt;release;
}</code></pre>

</dd>
</dl>

<h2 id="release($;$)"><a class="permalink" href="./Test2::API.html#release($;$)">#</a><a id="release"></a>release($;$)</h2>

<p>Usage:</p>

<dl>

<dt id="release-$ctx;"><a class="permalink" href="./Test2::API.html#release-$ctx;">#</a><a id="release1"></a><a id="release-ctx"></a>release $ctx;</dt>
<dd>

</dd>
<dt id="release-$ctx,-...;"><a class="permalink" href="./Test2::API.html#release-$ctx,-...;">#</a><a id="release2"></a><a id="release-ctx1"></a>release $ctx, ...;</dt>
<dd>

</dd>
</dl>

<p>This is intended as a shortcut that lets you release your context and return a value in one statement. This function will get your context, and an optional return value. It will release your context, then return your value. Scalar context is always assumed.</p>

<pre><code>sub tool {
    my $ctx = context();
    ...

    return release $ctx, 1;
}</code></pre>

<p>This tool is most useful when you want to return the value you get from calling a function that needs to see the current context:</p>

<pre><code>my $ctx = context();
my $out = some_tool(...);
$ctx-&gt;release;
return $out;</code></pre>

<p>We can combine the last 3 lines of the above like so:</p>

<pre><code>my $ctx = context();
release $ctx, some_tool(...);</code></pre>

<h2 id="context_do(&amp;;@)"><a class="permalink" href="./Test2::API.html#context_do(&amp;;@)">#</a><a id="context_do"></a>context_do(&amp;;@)</h2>

<p>Usage:</p>

<pre><code>sub my_tool {
    context_do {
        my $ctx = shift;

        my (@args) = @_;

        $ctx-&gt;ok(1, &quot;pass&quot;);

        ...

        # No need to call $ctx-&gt;release, done for you on scope exit.
    } @_;
}</code></pre>

<p>Using this inside your test tool takes care of a lot of boilerplate for you. It will ensure a context is acquired. It will capture and rethrow any exception. It will insure the context is released when you are done. It preserves the subroutine call context (array, scalar, void).</p>

<p>This is the safest way to write a test tool. The only two downsides to this are a slight performance decrease, and some extra indentation in your source. If the indentation is a problem for you then you can take a peek at the next section.</p>

<h2 id="no_context(&amp;;$)"><a class="permalink" href="./Test2::API.html#no_context(&amp;;$)">#</a><a id="no_context"></a>no_context(&amp;;$)</h2>

<p>Usage:</p>

<dl>

<dt id="no_context-{-...-};"><a class="permalink" href="./Test2::API.html#no_context-%7B-...-%7D;">#</a><a id="no_context1"></a>no_context { ... };</dt>
<dd>

</dd>
<dt id="no_context-{-...-}-$hid;"><a class="permalink" href="./Test2::API.html#no_context-%7B-...-%7D-$hid;">#</a><a id="no_context2"></a><a id="no_context-...-hid"></a>no_context { ... } $hid;</dt>
<dd>

<pre><code>sub my_tool(&amp;) {
    my $code = shift;
    my $ctx = context();
    ...

    no_context {
        # Things in here will not see our current context, they get a new
        # one.

        $code-&gt;();
    };

    ...
    $ctx-&gt;release;
};</code></pre>

</dd>
</dl>

<p>This tool will hide a context for the provided block of code. This means any tools run inside the block will get a completely new context if they acquire one. The new context will be inherited by tools nested below the one that acquired it.</p>

<p>This will normally hide the current context for the top hub. If you need to hide the context for a different hub you can pass in the optional <code>$hid</code> parameter.</p>

<h2 id="intercept(&amp;)"><a class="permalink" href="./Test2::API.html#intercept(&amp;)">#</a><a id="intercept"></a>intercept(&amp;)</h2>

<p>Usage:</p>

<pre><code>my $events = intercept {
    ok(1, &quot;pass&quot;);
    ok(0, &quot;fail&quot;);
    ...
};</code></pre>

<p>This function takes a codeblock as its only argument, and it has a prototype. It will execute the codeblock, intercepting any generated events in the process. It will return an array reference with all the generated event objects. All events should be subclasses of <a href="./Test2::Event.html">Test2::Event</a>.</p>

<p>As of version 1.302178 the events array that is returned is blssed as an <a href="./Test2::API::InterceptResult.html">Test2::API::InterceptResult</a> instance. <a href="./Test2::API::InterceptResult.html">Test2::API::InterceptResult</a> Provides a helpful interface for filtering and/or inspecting the events list overall, or individual events within the list.</p>

<p>This is intended to help you test your test code. This is not intended for people simply writing tests.</p>

<h2 id="run_subtest(...)"><a class="permalink" href="./Test2::API.html#run_subtest(...)">#</a><a id="run_subtest"></a>run_subtest(...)</h2>

<p>Usage:</p>

<pre><code>run_subtest($NAME, \&amp;CODE, $BUFFERED, @ARGS)

# or

run_subtest($NAME, \&amp;CODE, \%PARAMS, @ARGS)</code></pre>

<p>This will run the provided codeblock with the args in <code>@args</code>. This codeblock will be run as a subtest. A subtest is an isolated test state that is condensed into a single <a href="./Test2::Event::Subtest.html">Test2::Event::Subtest</a> event, which contains all events generated inside the subtest.</p>

<h3 id="ARGUMENTS:"><a class="permalink" href="./Test2::API.html#ARGUMENTS:">#</a><a id="ARGUMENTS"></a>ARGUMENTS:</h3>

<dl>

<dt id="$NAME"><a class="permalink" href="./Test2::API.html#$NAME">#</a><a id="NAME1"></a>$NAME</dt>
<dd>

<p>The name of the subtest.</p>

</dd>
<dt id="\&amp;CODE"><a class="permalink" href="./Test2::API.html#%5C&amp;CODE">#</a><a id="CODE"></a>\&amp;CODE</dt>
<dd>

<p>The code to run inside the subtest.</p>

</dd>
<dt id="$BUFFERED-or-\%PARAMS"><a class="permalink" href="./Test2::API.html#$BUFFERED-or-%5C%25PARAMS">#</a><a id="BUFFERED-or-PARAMS"></a>$BUFFERED or \%PARAMS</dt>
<dd>

<p>If this is a simple scalar then it will be treated as a boolean for the &#39;buffered&#39; setting. If this is a hash reference then it will be used as a parameters hash. The param hash will be used for hub construction (with the specified keys removed).</p>

<p>Keys that are removed and used by run_subtest:</p>

<dl>

<dt id="&#39;buffered&#39;-=&gt;-$bool"><a class="permalink" href="./Test2::API.html#&#39;buffered&#39;-=%3E-$bool">#</a><a id="buffered-bool"></a>&#39;buffered&#39; =&gt; $bool</dt>
<dd>

<p>Toggle buffered status.</p>

</dd>
<dt id="&#39;inherit_trace&#39;-=&gt;-$bool"><a class="permalink" href="./Test2::API.html#&#39;inherit_trace&#39;-=%3E-$bool">#</a><a id="inherit_trace-bool"></a>&#39;inherit_trace&#39; =&gt; $bool</dt>
<dd>

<p>Normally the subtest hub is pushed and the sub is allowed to generate its own root context for the hub. When this setting is turned on a root context will be created for the hub that shares the same trace as the current context.</p>

<p>Set this to true if your tool is producing subtests without user-specified subs.</p>

</dd>
<dt id="&#39;no_fork&#39;-=&gt;-$bool"><a class="permalink" href="./Test2::API.html#&#39;no_fork&#39;-=%3E-$bool">#</a><a id="no_fork-bool"></a>&#39;no_fork&#39; =&gt; $bool</dt>
<dd>

<p>Defaults to off. Normally forking inside a subtest will actually fork the subtest, resulting in 2 final subtest events. This parameter will turn off that behavior, only the original process/thread will return a final subtest event.</p>

</dd>
</dl>

</dd>
<dt id="@ARGS"><a class="permalink" href="./Test2::API.html#@ARGS">#</a><a id="ARGS"></a>@ARGS</dt>
<dd>

<p>Any extra arguments you want passed into the subtest code.</p>

</dd>
</dl>

<h3 id="BUFFERED-VS-UNBUFFERED-(OR-STREAMED)"><a class="permalink" href="./Test2::API.html#BUFFERED-VS-UNBUFFERED-(OR-STREAMED)">#</a><a id="BUFFERED"></a><a id="BUFFERED-VS-UNBUFFERED-OR-STREAMED"></a>BUFFERED VS UNBUFFERED (OR STREAMED)</h3>

<p>Normally all events inside and outside a subtest are sent to the formatter immediately by the hub. Sometimes it is desirable to hold off sending events within a subtest until the subtest is complete. This usually depends on the formatter being used.</p>

<dl>

<dt id="Things-not-effected-by-this-flag"><a class="permalink" href="./Test2::API.html#Things-not-effected-by-this-flag">#</a><a id="Things"></a>Things not effected by this flag</dt>
<dd>

<p>In both cases events are generated and stored in an array. This array is eventually used to populate the <code>subevents</code> attribute on the <a href="./Test2::Event::Subtest.html">Test2::Event::Subtest</a> event that is generated at the end of the subtest. This flag has no effect on this part, it always happens.</p>

<p>At the end of the subtest, the final <a href="./Test2::Event::Subtest.html">Test2::Event::Subtest</a> event is sent to the formatter.</p>

</dd>
<dt id="Things-that-are-effected-by-this-flag"><a class="permalink" href="./Test2::API.html#Things-that-are-effected-by-this-flag">#</a><a id="Things1"></a>Things that are effected by this flag</dt>
<dd>

<p>The <code>buffered</code> attribute of the <a href="./Test2::Event::Subtest.html">Test2::Event::Subtest</a> event will be set to the value of this flag. This means any formatter, listener, etc which looks at the event will know if it was buffered.</p>

</dd>
<dt id="Things-that-are-formatter-dependant"><a class="permalink" href="./Test2::API.html#Things-that-are-formatter-dependant">#</a><a id="Things2"></a>Things that are formatter dependant</dt>
<dd>

<p>Events within a buffered subtest may or may not be sent to the formatter as they happen. If a formatter fails to specify then the default is to <b>NOT SEND</b> the events as they are generated, instead the formatter can pull them from the <code>subevents</code> attribute.</p>

<p>A formatter can specify by implementing the <code>hide_buffered()</code> method. If this method returns true then events generated inside a buffered subtest will not be sent independently of the final subtest event.</p>

</dd>
</dl>

<p>An example of how this is used is the <a href="./Test2::Formatter::TAP.html">Test2::Formatter::TAP</a> formatter. For unbuffered subtests the events are rendered as they are generated. At the end of the subtest, the final subtest event is rendered, but the <code>subevents</code> attribute is ignored. For buffered subtests the opposite occurs, the events are NOT rendered as they are generated, instead the <code>subevents</code> attribute is used to render them all at once. This is useful when running subtests tests in parallel, since without it the output from subtests would be interleaved together.</p>

<h1 id="OTHER-API-EXPORTS"><a class="permalink" href="./Test2::API.html#OTHER-API-EXPORTS">#</a><a id="OTHER1"></a>OTHER API EXPORTS</h1>

<p>Exports in this section are not commonly needed. These all have the &#39;test2_&#39; prefix to help ensure they stand out. You should look at the <a href="./Test2::API.html#MAIN-API-EXPORTS">&quot;MAIN API EXPORTS&quot;</a> section before looking here. This section is one where &quot;Great power comes with great responsibility&quot;. It is possible to break things badly if you are not careful with these.</p>

<p>All exports are optional. You need to list which ones you want at import time:</p>

<pre><code>use Test2::API qw/test2_init_done .../;</code></pre>

<h2 id="STATUS-AND-INITIALIZATION-STATE"><a class="permalink" href="./Test2::API.html#STATUS-AND-INITIALIZATION-STATE">#</a><a id="STATUS"></a>STATUS AND INITIALIZATION STATE</h2>

<p>These provide access to internal state and object instances.</p>

<dl>

<dt id="$bool-=-test2_init_done()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_init_done()">#</a><a id="bool-test2_init_done"></a>$bool = test2_init_done()</dt>
<dd>

<p>This will return true if the stack and IPC instances have already been initialized. It will return false if they have not. Init happens as late as possible. It happens as soon as a tool requests the IPC instance, the formatter, or the stack.</p>

</dd>
<dt id="$bool-=-test2_load_done()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_load_done()">#</a><a id="bool-test2_load_done"></a>$bool = test2_load_done()</dt>
<dd>

<p>This will simply return the boolean value of the loaded flag. If Test2 has finished loading this will be true, otherwise false. Loading is considered complete the first time a tool requests a context.</p>

</dd>
<dt id="test2_set_is_end()"><a class="permalink" href="./Test2::API.html#test2_set_is_end()">#</a><a id="test2_set_is_end"></a>test2_set_is_end()</dt>
<dd>

</dd>
<dt id="test2_set_is_end($bool)"><a class="permalink" href="./Test2::API.html#test2_set_is_end($bool)">#</a><a id="test2_set_is_end1"></a><a id="test2_set_is_end-bool"></a>test2_set_is_end($bool)</dt>
<dd>

<p>This is used to toggle Test2&#39;s belief that the END phase has already started. With no arguments this will set it to true. With arguments it will set it to the first argument&#39;s value.</p>

<p>This is used to prevent the use of <code>caller()</code> in END blocks which can cause segfaults. This is only necessary in some persistent environments that may have multiple END phases.</p>

</dd>
<dt id="$bool-=-test2_get_is_end()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_get_is_end()">#</a><a id="bool-test2_get_is_end"></a>$bool = test2_get_is_end()</dt>
<dd>

<p>Check if Test2 believes it is the END phase.</p>

</dd>
<dt id="$stack-=-test2_stack()"><a class="permalink" href="./Test2::API.html#$stack-=-test2_stack()">#</a><a id="stack-test2_stack"></a>$stack = test2_stack()</dt>
<dd>

<p>This will return the global <a href="./Test2::API::Stack.html">Test2::API::Stack</a> instance. If this has not yet been initialized it will be initialized now.</p>

</dd>
<dt id="$bool-=-test2_is_testing_done()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_is_testing_done()">#</a><a id="bool-test2_is_testing_done"></a>$bool = test2_is_testing_done()</dt>
<dd>

<p>This will return true if testing is complete and no other events should be sent. This is useful in things like warning handlers where you might want to turn warnings into events, but need them to start acting like normal warnings when testing is done.</p>

<pre><code>$SIG{__WARN__} = sub {
    my ($warning) = @_;

    if (test2_is_testing_done()) {
        warn @_;
    }
    else {
        my $ctx = context();
        ...
        $ctx-&gt;release
    }
}</code></pre>

</dd>
<dt id="test2_ipc_disable"><a class="permalink" href="./Test2::API.html#test2_ipc_disable">#</a>test2_ipc_disable</dt>
<dd>

<p>Disable IPC.</p>

</dd>
<dt id="$bool-=-test2_ipc_diabled"><a class="permalink" href="./Test2::API.html#$bool-=-test2_ipc_diabled">#</a><a id="bool-test2_ipc_diabled"></a>$bool = test2_ipc_diabled</dt>
<dd>

<p>Check if IPC is disabled.</p>

</dd>
<dt id="test2_ipc_wait_enable()"><a class="permalink" href="./Test2::API.html#test2_ipc_wait_enable()">#</a><a id="test2_ipc_wait_enable"></a>test2_ipc_wait_enable()</dt>
<dd>

</dd>
<dt id="test2_ipc_wait_disable()"><a class="permalink" href="./Test2::API.html#test2_ipc_wait_disable()">#</a><a id="test2_ipc_wait_disable"></a>test2_ipc_wait_disable()</dt>
<dd>

</dd>
<dt id="$bool-=-test2_ipc_wait_enabled()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_ipc_wait_enabled()">#</a><a id="bool-test2_ipc_wait_enabled"></a>$bool = test2_ipc_wait_enabled()</dt>
<dd>

<p>These can be used to turn IPC waiting on and off, or check the current value of the flag.</p>

<p>Waiting is turned on by default. Waiting will cause the parent process/thread to wait until all child processes and threads are finished before exiting. You will almost never want to turn this off.</p>

</dd>
<dt id="$bool-=-test2_no_wait()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_no_wait()">#</a><a id="bool-test2_no_wait"></a>$bool = test2_no_wait()</dt>
<dd>

</dd>
<dt id="test2_no_wait($bool)"><a class="permalink" href="./Test2::API.html#test2_no_wait($bool)">#</a><a id="test2_no_wait"></a><a id="test2_no_wait-bool"></a>test2_no_wait($bool)</dt>
<dd>

<p><b>DISCOURAGED</b>: This is a confusing interface, it is better to use <code>test2_ipc_wait_enable()</code>, <code>test2_ipc_wait_disable()</code> and <code>test2_ipc_wait_enabled()</code>.</p>

<p>This can be used to get/set the no_wait status. Waiting is turned on by default. Waiting will cause the parent process/thread to wait until all child processes and threads are finished before exiting. You will almost never want to turn this off.</p>

</dd>
<dt id="$fh-=-test2_stdout()"><a class="permalink" href="./Test2::API.html#$fh-=-test2_stdout()">#</a><a id="fh-test2_stdout"></a>$fh = test2_stdout()</dt>
<dd>

</dd>
<dt id="$fh-=-test2_stderr()"><a class="permalink" href="./Test2::API.html#$fh-=-test2_stderr()">#</a><a id="fh-test2_stderr"></a>$fh = test2_stderr()</dt>
<dd>

<p>These functions return the filehandles that test output should be written to. They are primarily useful when writing a custom formatter and code that turns events into actual output (TAP, etc.). They will return a dupe of the original filehandles that formatted output can be sent to regardless of whatever state the currently running test may have left STDOUT and STDERR in.</p>

</dd>
<dt id="test2_reset_io()"><a class="permalink" href="./Test2::API.html#test2_reset_io()">#</a><a id="test2_reset_io"></a>test2_reset_io()</dt>
<dd>

<p>Re-dupe the internal filehandles returned by <code>test2_stdout()</code> and <code>test2_stderr()</code> from the current STDOUT and STDERR. You shouldn&#39;t need to do this except in very peculiar situations (for example, you&#39;re testing a new formatter and you need control over where the formatter is sending its output.)</p>

</dd>
</dl>

<h2 id="BEHAVIOR-HOOKS"><a class="permalink" href="./Test2::API.html#BEHAVIOR-HOOKS">#</a><a id="BEHAVIOR"></a>BEHAVIOR HOOKS</h2>

<p>These are hooks that allow you to add custom behavior to actions taken by Test2 and tools built on top of it.</p>

<dl>

<dt id="test2_add_callback_exit(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_exit(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_exit"></a><a id="test2_add_callback_exit-sub"></a>test2_add_callback_exit(sub { ... })</dt>
<dd>

<p>This can be used to add a callback that is called after all testing is done. This is too late to add additional results, the main use of this callback is to set the exit code.</p>

<pre><code>test2_add_callback_exit(
    sub {
        my ($context, $exit, \$new_exit) = @_;
        ...
    }
);</code></pre>

<p>The <code>$context</code> passed in will be an instance of <a href="./Test2::API::Context.html">Test2::API::Context</a>. The <code>$exit</code> argument will be the original exit code before anything modified it. <code>$$new_exit</code> is a reference to the new exit code. You may modify this to change the exit code. Please note that <code>$$new_exit</code> may already be different from <code>$exit</code></p>

</dd>
<dt id="test2_add_callback_post_load(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_post_load(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_post_load"></a><a id="test2_add_callback_post_load-sub"></a>test2_add_callback_post_load(sub { ... })</dt>
<dd>

<p>Add a callback that will be called when Test2 is finished loading. This means the callback will be run once, the first time a context is obtained. If Test2 has already finished loading then the callback will be run immediately.</p>

</dd>
<dt id="test2_add_callback_testing_done(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_testing_done(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_testing_done"></a><a id="test2_add_callback_testing_done-sub"></a>test2_add_callback_testing_done(sub { ... })</dt>
<dd>

<p>This adds your coderef as a follow-up to the root hub after Test2 is finished loading.</p>

<p>This is essentially a helper to do the following:</p>

<pre><code>test2_add_callback_post_load(sub {
    my $stack = test2_stack();
    $stack-&gt;top; # Insure we have a hub
    my ($hub) = Test2::API::test2_stack-&gt;all;

    $hub-&gt;set_active(1);

    $hub-&gt;follow_up(sub { ... }); # &lt;-- Your coderef here
});</code></pre>

</dd>
<dt id="test2_add_callback_context_acquire(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_context_acquire(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_context_acquire"></a><a id="test2_add_callback_context_acquire-sub"></a>test2_add_callback_context_acquire(sub { ... })</dt>
<dd>

<p>Add a callback that will be called every time someone tries to acquire a context. This will be called on EVERY call to <code>context()</code>. It gets a single argument, a reference to the hash of parameters being used the construct the context. This is your chance to change the parameters by directly altering the hash.</p>

<pre><code>test2_add_callback_context_acquire(sub {
    my $params = shift;
    $params-&gt;{level}++;
});</code></pre>

<p>This is a very scary API function. Please do not use this unless you need to. This is here for <a href="./Test::Builder.html">Test::Builder</a> and backwards compatibility. This has you directly manipulate the hash instead of returning a new one for performance reasons.</p>

</dd>
<dt id="test2_add_callback_context_init(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_context_init(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_context_init"></a><a id="test2_add_callback_context_init-sub"></a>test2_add_callback_context_init(sub { ... })</dt>
<dd>

<p>Add a callback that will be called every time a new context is created. The callback will receive the newly created context as its only argument.</p>

</dd>
<dt id="test2_add_callback_context_release(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_context_release(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_context_release"></a><a id="test2_add_callback_context_release-sub"></a>test2_add_callback_context_release(sub { ... })</dt>
<dd>

<p>Add a callback that will be called every time a context is released. The callback will receive the released context as its only argument.</p>

</dd>
<dt id="test2_add_callback_pre_subtest(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_callback_pre_subtest(sub-%7B-...-%7D)">#</a><a id="test2_add_callback_pre_subtest"></a><a id="test2_add_callback_pre_subtest-sub"></a>test2_add_callback_pre_subtest(sub { ... })</dt>
<dd>

<p>Add a callback that will be called every time a subtest is going to be run. The callback will receive the subtest name, coderef, and any arguments.</p>

</dd>
<dt id="@list-=-test2_list_context_acquire_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_context_acquire_callbacks()">#</a><a id="list-test2_list_context_acquire_callbacks"></a>@list = test2_list_context_acquire_callbacks()</dt>
<dd>

<p>Return all the context acquire callback references.</p>

</dd>
<dt id="@list-=-test2_list_context_init_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_context_init_callbacks()">#</a><a id="list-test2_list_context_init_callbacks"></a>@list = test2_list_context_init_callbacks()</dt>
<dd>

<p>Returns all the context init callback references.</p>

</dd>
<dt id="@list-=-test2_list_context_release_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_context_release_callbacks()">#</a><a id="list-test2_list_context_release_callbacks"></a>@list = test2_list_context_release_callbacks()</dt>
<dd>

<p>Returns all the context release callback references.</p>

</dd>
<dt id="@list-=-test2_list_exit_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_exit_callbacks()">#</a><a id="list-test2_list_exit_callbacks"></a>@list = test2_list_exit_callbacks()</dt>
<dd>

<p>Returns all the exit callback references.</p>

</dd>
<dt id="@list-=-test2_list_post_load_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_post_load_callbacks()">#</a><a id="list-test2_list_post_load_callbacks"></a>@list = test2_list_post_load_callbacks()</dt>
<dd>

<p>Returns all the post load callback references.</p>

</dd>
<dt id="@list-=-test2_list_pre_subtest_callbacks()"><a class="permalink" href="./Test2::API.html#@list-=-test2_list_pre_subtest_callbacks()">#</a><a id="list-test2_list_pre_subtest_callbacks"></a>@list = test2_list_pre_subtest_callbacks()</dt>
<dd>

<p>Returns all the pre-subtest callback references.</p>

</dd>
<dt id="test2_add_uuid_via(sub-{-...-})"><a class="permalink" href="./Test2::API.html#test2_add_uuid_via(sub-%7B-...-%7D)">#</a><a id="test2_add_uuid_via"></a><a id="test2_add_uuid_via-sub"></a>test2_add_uuid_via(sub { ... })</dt>
<dd>

</dd>
<dt id="$sub-=-test2_add_uuid_via()"><a class="permalink" href="./Test2::API.html#$sub-=-test2_add_uuid_via()">#</a><a id="sub-test2_add_uuid_via"></a>$sub = test2_add_uuid_via()</dt>
<dd>

<p>This allows you to provide a UUID generator. If provided UUIDs will be attached to all events, hubs, and contexts. This is useful for storing, tracking, and linking these objects.</p>

<p>The sub you provide should always return a unique identifier. Most things will expect a proper UUID string, however nothing in Test2::API enforces this.</p>

<p>The sub will receive exactly 1 argument, the type of thing being tagged &#39;context&#39;, &#39;hub&#39;, or &#39;event&#39;. In the future additional things may be tagged, in which case new strings will be passed in. These are purely informative, you can (and usually should) ignore them.</p>

</dd>
</dl>

<h2 id="IPC-AND-CONCURRENCY"><a class="permalink" href="./Test2::API.html#IPC-AND-CONCURRENCY">#</a><a id="IPC"></a>IPC AND CONCURRENCY</h2>

<p>These let you access, or specify, the IPC system internals.</p>

<dl>

<dt id="$bool-=-test2_has_ipc()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_has_ipc()">#</a><a id="bool-test2_has_ipc"></a>$bool = test2_has_ipc()</dt>
<dd>

<p>Check if IPC is enabled.</p>

</dd>
<dt id="$ipc-=-test2_ipc()"><a class="permalink" href="./Test2::API.html#$ipc-=-test2_ipc()">#</a><a id="ipc-test2_ipc"></a>$ipc = test2_ipc()</dt>
<dd>

<p>This will return the global <a href="./Test2::IPC::Driver.html">Test2::IPC::Driver</a> instance. If this has not yet been initialized it will be initialized now.</p>

</dd>
<dt id="test2_ipc_add_driver($DRIVER)"><a class="permalink" href="./Test2::API.html#test2_ipc_add_driver($DRIVER)">#</a><a id="test2_ipc_add_driver"></a><a id="test2_ipc_add_driver-DRIVER"></a>test2_ipc_add_driver($DRIVER)</dt>
<dd>

<p>Add an IPC driver to the list. This will add the driver to the start of the list.</p>

</dd>
<dt id="@drivers-=-test2_ipc_drivers()"><a class="permalink" href="./Test2::API.html#@drivers-=-test2_ipc_drivers()">#</a><a id="drivers-test2_ipc_drivers"></a>@drivers = test2_ipc_drivers()</dt>
<dd>

<p>Get the list of IPC drivers.</p>

</dd>
<dt id="$bool-=-test2_ipc_polling()"><a class="permalink" href="./Test2::API.html#$bool-=-test2_ipc_polling()">#</a><a id="bool-test2_ipc_polling"></a>$bool = test2_ipc_polling()</dt>
<dd>

<p>Check if polling is enabled.</p>

</dd>
<dt id="test2_ipc_enable_polling()"><a class="permalink" href="./Test2::API.html#test2_ipc_enable_polling()">#</a><a id="test2_ipc_enable_polling"></a>test2_ipc_enable_polling()</dt>
<dd>

<p>Turn on polling. This will cull events from other processes and threads every time a context is created.</p>

</dd>
<dt id="test2_ipc_disable_polling()"><a class="permalink" href="./Test2::API.html#test2_ipc_disable_polling()">#</a><a id="test2_ipc_disable_polling"></a>test2_ipc_disable_polling()</dt>
<dd>

<p>Turn off IPC polling.</p>

</dd>
<dt id="test2_ipc_enable_shm()"><a class="permalink" href="./Test2::API.html#test2_ipc_enable_shm()">#</a><a id="test2_ipc_enable_shm"></a>test2_ipc_enable_shm()</dt>
<dd>

<p>Legacy, this is currently a no-op that returns 0;</p>

</dd>
<dt id="test2_ipc_set_pending($uniq_val)"><a class="permalink" href="./Test2::API.html#test2_ipc_set_pending($uniq_val)">#</a><a id="test2_ipc_set_pending"></a><a id="test2_ipc_set_pending-uniq_val"></a>test2_ipc_set_pending($uniq_val)</dt>
<dd>

<p>Tell other processes and events that an event is pending. <code>$uniq_val</code> should be a unique value no other thread/process will generate.</p>

<p><b>Note:</b> After calling this <code>test2_ipc_get_pending()</code> will return 1. This is intentional, and not avoidable.</p>

</dd>
<dt id="$pending-=-test2_ipc_get_pending()"><a class="permalink" href="./Test2::API.html#$pending-=-test2_ipc_get_pending()">#</a><a id="pending-test2_ipc_get_pending"></a>$pending = test2_ipc_get_pending()</dt>
<dd>

<p>This returns -1 if there is no way to check (assume yes)</p>

<p>This returns 0 if there are (most likely) no pending events.</p>

<p>This returns 1 if there are (likely) pending events. Upon return it will reset, nothing else will be able to see that there were pending events.</p>

</dd>
<dt id="$timeout-=-test2_ipc_get_timeout()"><a class="permalink" href="./Test2::API.html#$timeout-=-test2_ipc_get_timeout()">#</a><a id="timeout-test2_ipc_get_timeout"></a>$timeout = test2_ipc_get_timeout()</dt>
<dd>

</dd>
<dt id="test2_ipc_set_timeout($timeout)"><a class="permalink" href="./Test2::API.html#test2_ipc_set_timeout($timeout)">#</a><a id="test2_ipc_set_timeout"></a><a id="test2_ipc_set_timeout-timeout"></a>test2_ipc_set_timeout($timeout)</dt>
<dd>

<p>Get/Set the timeout value for the IPC system. This timeout is how long the IPC system will wait for child processes and threads to finish before aborting.</p>

<p>The default value is <code>30</code> seconds.</p>

</dd>
</dl>

<h2 id="MANAGING-FORMATTERS"><a class="permalink" href="./Test2::API.html#MANAGING-FORMATTERS">#</a><a id="MANAGING"></a>MANAGING FORMATTERS</h2>

<p>These let you access, or specify, the formatters that can/should be used.</p>

<dl>

<dt id="$formatter-=-test2_formatter"><a class="permalink" href="./Test2::API.html#$formatter-=-test2_formatter">#</a><a id="formatter-test2_formatter"></a>$formatter = test2_formatter</dt>
<dd>

<p>This will return the global formatter class. This is not an instance. By default the formatter is set to <a href="./Test2::Formatter::TAP.html">Test2::Formatter::TAP</a>.</p>

<p>You can override this default using the <code>T2_FORMATTER</code> environment variable.</p>

<p>Normally &#39;Test2::Formatter::&#39; is prefixed to the value in the environment variable:</p>

<pre><code class="plaintext">$ T2_FORMATTER=&#39;TAP&#39; perl test.t     # Use the Test2::Formatter::TAP formatter
$ T2_FORMATTER=&#39;Foo&#39; perl test.t     # Use the Test2::Formatter::Foo formatter</code></pre>

<p>If you want to specify a full module name you use the &#39;+&#39; prefix:</p>

<pre><code class="plaintext">$ T2_FORMATTER=&#39;+Foo::Bar&#39; perl test.t     # Use the Foo::Bar formatter</code></pre>

</dd>
<dt id="test2_formatter_set($class_or_instance)"><a class="permalink" href="./Test2::API.html#test2_formatter_set($class_or_instance)">#</a><a id="test2_formatter_set"></a><a id="test2_formatter_set-class_or_instance"></a>test2_formatter_set($class_or_instance)</dt>
<dd>

<p>Set the global formatter class. This can only be set once. <b>Note:</b> This will override anything specified in the &#39;T2_FORMATTER&#39; environment variable.</p>

</dd>
<dt id="@formatters-=-test2_formatters()"><a class="permalink" href="./Test2::API.html#@formatters-=-test2_formatters()">#</a><a id="formatters-test2_formatters"></a>@formatters = test2_formatters()</dt>
<dd>

<p>Get a list of all loaded formatters.</p>

</dd>
<dt id="test2_formatter_add($class_or_instance)"><a class="permalink" href="./Test2::API.html#test2_formatter_add($class_or_instance)">#</a><a id="test2_formatter_add"></a><a id="test2_formatter_add-class_or_instance"></a>test2_formatter_add($class_or_instance)</dt>
<dd>

<p>Add a formatter to the list. Last formatter added is used at initialization. If this is called after initialization a warning will be issued.</p>

</dd>
</dl>

<h1 id="OTHER-EXAMPLES"><a class="permalink" href="./Test2::API.html#OTHER-EXAMPLES">#</a><a id="OTHER2"></a>OTHER EXAMPLES</h1>

<p>See the <code>/Examples/</code> directory included in this distribution.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Test2::API.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="./Test2::API::Context.html">Test2::API::Context</a> - Detailed documentation of the context object.</p>

<p><a href="./Test2::IPC.html">Test2::IPC</a> - The IPC system used for threading/fork support.</p>

<p><a href="./Test2::Formatter.html">Test2::Formatter</a> - Formatters such as TAP live here.</p>

<p><a href="./Test2::Event.html">Test2::Event</a> - Events live in this namespace.</p>

<p><a href="./Test2::Hub.html">Test2::Hub</a> - All events eventually funnel through a hub. Custom hubs are how <code>intercept()</code> and <code>run_subtest()</code> are implemented.</p>

<h1 id="MAGIC"><a class="permalink" href="./Test2::API.html#MAGIC">#</a>MAGIC</h1>

<p>This package has an END block. This END block is responsible for setting the exit code based on the test results. This end block also calls the callbacks that can be added to this package.</p>

<h1 id="SOURCE"><a class="permalink" href="./Test2::API.html#SOURCE">#</a>SOURCE</h1>

<p>The source code repository for Test2 can be found at <i>http://github.com/Test-More/test-more/</i>.</p>

<h1 id="MAINTAINERS"><a class="permalink" href="./Test2::API.html#MAINTAINERS">#</a>MAINTAINERS</h1>

<dl>

<dt id="Chad-Granum"><a class="permalink" href="./Test2::API.html#Chad-Granum">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;"></a><a id="Chad"></a><a id="Chad-Granum-exodist-cpan.org"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="AUTHORS"><a class="permalink" href="./Test2::API.html#AUTHORS">#</a>AUTHORS</h1>

<dl>

<dt id="Chad-Granum1"><a class="permalink" href="./Test2::API.html#Chad-Granum1">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;1"></a><a id="Chad1"></a><a id="Chad-Granum-exodist-cpan.org1"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="COPYRIGHT"><a class="permalink" href="./Test2::API.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>Copyright 2020 Chad Granum &lt;exodist@cpan.org&gt;.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <i>http://dev.perl.org/licenses/</i></p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
